package com.aegis.gateway.constants;

/**
 * @Author renogo
 * 
 * @Version 1.0
 * @Descritube
 */
public class TokenRedisConstants {
    public static final String MODULE_NAME = "token";

    public static final String USER_PERMISSION = MODULE_NAME + ":permission";

    public static final String USER_ROLE = MODULE_NAME + ":role";

    public static final String USER_INFO = MODULE_NAME + ":user_info";



    /**
     * 2分钟权限缓存
     */
    public static final long DEFAULT_PERMISSION_EXPIRE = 60 * 2;

    /**
     * 查询用户权限key
     * @param userId
     * @return
     */
    public static String getUserInfo(String userId) {
        return USER_INFO + ":" + userId;
    }


    /**
     * 查询用户权限key
     * @param userId
     * @return
     */
    public static String getUserPermission(String userId) {
        return USER_PERMISSION + ":" + userId;
    }

    /**
     * 查询用户角色key
     * @param userId
     * @return
     */
    public static String getUserRole(String userId) {
        return USER_ROLE + ":" + userId;
    }




    /**
     * @param token
     * @return
     */
    public static String getLoginUserInfoRedisKey(String id, String token) {
        return MODULE_NAME + ":" + id + ":" + token;
    }

}
